import type { Module, ActionContext } from 'vuex'
import type { AxiosResponse } from 'axios'
import type { workStateType } from './typings'
import { workDataListPageGet } from '~/api/monitor/work'

const work: Module<workStateType, workStateType> = {
  namespaced: true,
  state: {},
  getters: {},
  mutations: {},
  actions: {
    //  设备管理-列表
    WorkDataListPageGet<S, T>(_: ActionContext<S, T>, params: T) {
      return new Promise((resolve, reject) => {
        workDataListPageGet<T>(params)
          .then((res: AxiosResponse) => {
            resolve(res.data)
          })
          .catch((err: AxiosResponse) => {
            reject(err)
          })
      })
    }
  }
}

export default work
